<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

// Udah login ngapain login lagi

$success = true;
$username = "";
$password = "";
$defaultpath = "./../Desktop/Tubes5Progin/Upload";
if (isset($_POST["login"])) {
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    $userLogin = new user("WHERE `username` = '$username'");
    if ($userLogin->getUserNumRows() != 0 && $password == $userLogin->getPassword()) {
        $_SESSION["username"] = $userLogin->getUserName();
        //echo $_SESSION["username"];
     } else {
        $success = false;
    }
    
    if ($success)
        header("location: userfile.php?username=".$userLogin->getUserName()."&path=".$defaultpath."/".$userLogin->getUserName());
}
?>
